-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
P0619R4 Removing C++17-Deprecated Features #380
Conversation
279102c
to
0f9e2d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect we will need escape hatch macros for these, at least:
- an escape hatch that brings back the extra typedefs
- an escape hatch that brings back shared_ptr::unique
- an escape hatch that brings back is_pod
- an escape hatch that brings back result_of
I'd prefer to see a single escape hatch in the style of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be missing at least uncaught_exception
; please audit P0619R4 to ensure you haven't missed other removals.
Our experience with Then again I'm on record saying the standard shouldn't ever remove anything :) |
if we continue to deprecate and remove stuff from the standard but not the code it may make sense to have something like |
Having proposed WG21-N4190 and implemented I think that following the design we've been using for deprecations would be optimal - that is, fine-grained escape hatches, which are also controlled by an overall escape hatch. The naming for the overall escape hatch could be verbose like (Separately, we could retrofit the C++17 removal macros accordingly, but I'd want to see that as a followup change, and no action might be necessary there.) |
I think having only a coarse-grained hatch encourages faster migration. Folks who don't care about deprecation/removal also don't care about coarse vs. fine - they'll just hit the big red button and go about their business either way. Folks who do care about avoiding dependencies on deprecated/removed features will eradicate all uses from local code, and only use escape hatches for third-party code. If we give them fine-grained hatches, they will enable only those necessary for their third-party code to compile thereby reducing their exposure. If we give them only coarse-grained hatches, they will have to accept maximum exposure to use any third-party code that uses a deprecated/removed feature. Being more dissatisfied in the latter case encourages the motivated users to push harder on unmotivated authors of third-party code. That said, I am motivated just enough by this question to type this explanation - I won't die on this hill, but I'll yell loudly as I retreat ;) |
We still have to enable My argument is straightforward - we use a fine+coarse combo for deprecations, following that for removals seems consistent. |
I started implementing the changes, but for adaptor typedefs it is a bit more work. |
0f9e2d3
to
3e157cc
Compare
I added escape hatches to retain the removed features. I hope that this is what was expected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have not double checked the paper or attempted the tests yet but this looks reasonable
stl/inc/ostream
Outdated
@@ -109,7 +109,11 @@ public: | |||
_STL_DISABLE_DEPRECATED_WARNING | |||
__CLR_OR_THIS_CALL ~sentry() noexcept { | |||
#if _HAS_EXCEPTIONS | |||
#if _HAS_DEPRECATED_UNCAUGHT_EXCEPTION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still blocked by ArchivedOS-12000909. @amyw-msft Do you know what the status of that is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any update here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Windows doesn't build in C++20 mode, and won't start trying until C++20 is fully implemented, so I think we're unblocked here. (Also, the Windows build can simply define the fine-grained escape hatch macro.)
But is_pod hasn't been removed yet. Shouldn't it at least be available by default? |
I will try to have a look on it this evening |
3e157cc
to
deab11d
Compare
I addressed most review comments. As There are some remaining comments from @BillyONeal that I would like to wait on. I did not silence the warnings when somebody retains the removed features. They should carry that cost. Also one stylistic question remains. Currently I use |
Agreed! Also consistent with the
That's a good question - of those two, I prefer However, I worry a little bit about grammatical ambiguity - the intent is "has meow, a removed feature in C++20" (i.e. "removed" is an adjective), but it could also be read as "this macro has removed (verb) meow", which is the opposite sense. The older macros So, two more ideas:
The more I think about it, the more I like |
I fully concur with your reasoning. However I believe that indeed In contrast |
deab11d
to
75f5313
Compare
I dropped the allocator patch due to @BillyONeal comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
This looks good to me provided @StephanTLavavej (the deprecations and removals czar) and @amyw-msft (for ArchivedOS-12000909 ) are OK with it.
This updates llvm-project as the escape hatch macro has been checked in upstream. This updates skipped_tests.txt because non-Standard code has appeared in the to_array test.
...to `_HAS_FEATURES_REMOVED_IN_CXX20`. Fixes microsoft#478.
Thank you for helping encourage the C++ community to modernize their codebases! This has passed our internal testing and has been merged for VS 2019 16.6 Preview 2. We’ll need to report issues in various “Real World Code” projects (e.g. Boost) this week as our extended test suites run. |
Also filed Dolphin-11970 "fmt 5.3.0 is incompatible with C++20" (fixed in fmt 6.0.0). |
Description
This implements #28 by conditionally removing deprecated features when compiling in C++20 mode following the guidance from P0619R4
Checklist
Be sure you've read README.md and understand the scope of this repo.
If you're unsure about a box, leave it unchecked. A maintainer will help you.
_Ugly
as perhttps://eel.is/c++draft/lex.name#3.1 or there are no product code changes.
verified by an STL maintainer before automated testing is enabled on GitHub,
leave this unchecked for initial submission).
members, adding virtual functions, changing whether a type is an aggregate
or trivially copyable, etc.).
the C++ Working Draft (including any cited standards), other WG21 papers
(excluding reference implementations outside of proposed standard wording),
and LWG issues as reference material. If they were derived from a project
that's already listed in NOTICE.txt, that's fine, but please mention it.
If they were derived from any other project (including Boost and libc++,
which are not yet listed in NOTICE.txt), you must mention it here,
so we can determine whether the license is compatible and what else needs
to be done.